<?php
include_once './inc/isLogin.php';
include_once("./../fckeditor/fckeditor.php") ;

//bof fckeditor
if(true){
	$oFCKeditor = new FCKeditor('ads_content') ;//字段名字
	$oFCKeditor->BasePath = './../fckeditor/' ;
	$oFCKeditor->Height = 400; 
	$oFCKeditor->Width = 720; 
	$oFCKeditor->Config['EnterMode'] = 'br';
	
	//注意修改上传目录：fckeditor\editor\filemanager\connectors\php\config.php
	//$Config['UserFilesPath'] = '/tf/php_fck/userfiles/' ;
	
	//上传的图片命名规则:
	//fckeditor\editor\filemanager\connectors\php\commands.php
	//$sFileName=time().rand(0,100).".".$sExtension;
	
}
//end fckeditor
?>
<?php

//数据库中guanggao表的A字段内容代表广告位置的永久链接
	$article_id = 0;
	if($_GET['article']=='hezuohuoban'){
		$title_ads = '合作伙伴设置';
		$article_id = 1;
	}
	
	if($article_id == 0){exit;}
	
	//准备装载数据
	require_once("./../includes/configure.php");
	require_once("./../includes/database.php");
	$db = Database::Connect();
	
	//更新
	if($_POST['submit']){
		$ads_this_id = $_POST['this_id'];
		$ads_content = $_POST['ads_content'];
		$sql = "update common_article set content ='$ads_content' WHERE this_id=$ads_this_id";   
		$db->Execute($sql);
		$update_result = '更新完成';
	}
	//end 更新
	
   
    $sql = "SELECT * FROM common_article WHERE A=$article_id";   
    $row = $db->GetSingleRow($sql);

	$oFCKeditor->Value = $row->content;//<?php echo $row->content;? >
	
?>
<div class="top-bar" style=" border-bottom: 2px solid #FF7700;padding:10px;">
	<?//<a href="#" class="button">ADD NEW </a>?>
	<h1><?php echo $title_ads;?></h1>
	<div class="breadcrumbs">
		<?php //<a href="#">Homepage</a> / <a href="#">Contents</a>?>
		提示:为避免修改照成一些错误,修改前您可以复制(备份)内容到记事本
	</div>
</div><br />

<br/><br/><br/><br/>
<span class="green info">
<?php 
if($update_result){
	echo $update_result;
	echo '<br/><br/>';
}
?>
</span>
<form action="" method="post" enctype="multipart/form-data" id="ads_form" name="ads_form">
<?php
	/*
	<textarea name="ads_content" id="ads_content" cols="110" rows="5">
    </textarea>
	*/
?>
	<?php $oFCKeditor->Create() ; //就像一个普通input一样,放在form中?>
	<input type="hidden" name="this_id" value="<?php echo $row->this_id;?>">
	<br/><br/><input type="submit" name="submit" value="确认修改" style="padding:5px;padding-left:10px;padding-right:10px;">
</form>

